clear
clear matrix
clear mata
set maxvar 32000

use "RELP_clean_deidentified", clear
 

*RESEARCH QUESTION 3 (and 6!)*
*What are the impacts of the RELP and the RELP+PSP, relative to a wait-list control group 
*who receives no programming, on child development (early literacy, early numeracy, 
*social/emotional, and motor skills) and frequency of child play? 

*Overall IDELA*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestID) dots: mixed IDELA_el i.tx IDELA_bl re ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 

*early literacy*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestLIT) dots: mixed IDLIT_el i.tx IDLIT_bl re ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 

*early numeracy*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestNUM) dots: mixed IDNUM_el i.tx IDNUM_bl re ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 

*socio-emotional*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestSEL) dots: mixed IDSEL_el i.tx IDSEL_bl re ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) difficult emiterate(800) iterate(100)

mi testtransform diff 

*motor skills*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestMOT) dots: mixed IDMOT_el i.tx IDMOT_bl re ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 


*frequency of child play*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestplfr) dots: mixed playfreq_el i.tx playfreq_bl ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 



*RESEARCH QUESTION 4 (and 6!)*
*What are the impacts of the RELP and the RELP+PSP, relative to the control group, on parenting 
*(caregiver reported perceptions/beliefs about learning through play and social/emotional learning; 
*caregiver reported interactions with the child; parenting stress; parenting self-efficacy)?

*Beliefs about learning through play*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestbelpl) errorok dots: mixed belpl_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.belpl_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) difficult emiterate(17000) iterate(100)

mi testtransform diff 

*Beliefs about SEL*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestbelsel) dots: mixed belsel_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.belsel_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 

*caregiver/other hh member with child interactions*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestecdact) errorok dots: mixed ecdact_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.ecdact_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) iterate(100)

mi testtransform diff 
*didn't run on m=80 (only one of these new models that we had this issue with)

*parenting stress*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestpss) dots: mixed pss_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.pss_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 

*parenting self-efficacy*

*Discipline*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestpsed) dots: mixed psedis_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.psedis_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 

*Nurturance*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestpsen) dots: mixed psenur_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.psenur_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 

*Play*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestpsep) dots: mixed pseply_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.pseply_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 


*RESEARCH QUESTION 5 (and 6!)*
*What are the impacts of the RELP and the RELP+PSP, relative to the control group, on caregiver 
*being, depression, anxiety)?

*Depressive Symptoms*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestphq) dots: mixed PHQ_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.PHQ_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 

*Anxiety Symptoms*
mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestgad) dots: mixed GAD_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(c.GAD_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons reml residuals(independent, by(tx)) 

mi testtransform diff 

**** DISCIPLINING DATA:
*discipline data not hanging together
*BUT hearing a lot on 'used to hit my child and now I do not' from qualitative interviews

codebook p_gha_1j_el p_gha_1b_el p_gha_1e_el p_gha_1f_el p_gha_1l_el p_gha_1m_el p_gha_1j_bl p_gha_1b_bl p_gha_1e_bl p_gha_1f_bl p_gha_1l_bl p_gha_1m_bl


*logit for whether hit at all or not
mi passive: gen neverhit_el=0 
mi passive: replace neverhit_el=1 if p_gha_1f_el==1
mi passive: gen neverhit_bl=0 
mi passive: replace neverhit_bl=1 if p_gha_1f_bl==1

mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestneverhit) dots errorok: meqrlogit neverhit_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(neverhit_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons  

mi testtransform diff 

*logit for hit more than once a week
mi passive: gen freqhit_el=0
mi passive: replace freqhit_el=1 if p_gha_1f_el==3
mi passive: gen freqhit_bl=0
mi passive: replace freqhit_bl=1 if p_gha_1f_bl==3

mi estimate (diff: _b[1.tx] - _b[2.tx]), saving(miestfreqhit) dots: meqrlogit freqhit_el i.tx  ///
lebanese govern fam_type b_move_t_bl hh_num_bl hh_ch_u6_bl p_env11_bl ses_bl persup_bl /// /*household*/
cg_change##(freqhit_bl c.b_educ_bl c.b_read_n_bl c.ss_famil_bl c.ss_frien_bl c.h_o_ment_bl c.h_o_gen_bl) /// /*caregiver*/
Chfem fc_heal_bl priorece tch_change rand1st /// /*child + randomization batch*/
|| teacher: nest, nocons ///
|| classroom: nest, nocons  

mi testtransform diff 

